#include <iostream>
using namespace std;
int main(){
 string s1,s2,d,i;
 cout << "write";
 cin >> d;
   for (char i: d){
     if ( i == '(') s1 +=i;

       if ( i == ')'){
         s2 += i;

             if(s1.length() > 0){
                 if (s1[s1.length() - 1] == '('){
                   s1.pop_back();
                   s2.pop_back();
                 }
             }
     }
    }
    for (char i: d){
     if ( i == '[') s1 += i;

       if ( i == ']'){
         s2 += i;

             if(s1.length() > 0){
                 if (s1[s1.length() - 1] == '[')
                   s1.pop_back();
                   s2.pop_back();
                 }
             }
     }
     for (char i: d){
     if ( i == '{') s1 += i;

       if ( i == '}'){
         s2 += i;

             if(s1.length() > 0){
                 if (s1[s1.length() - 1] == '{'){
                   s1.pop_back();
                   s2.pop_back();
                 }
             }
     }


   }


 if (s1.length() == 0 and s2.length() == 0) cout << "True"<<endl;
 else   cout << "False" << endl;
 return 0;

}
